<?php

namespace app\yj\model;

use think\Model;

class UserModel extends Model
{
    //
    protected $table = 'user';


    public function setRolesAttr($value)
    {
        return json_encode($value);
    }

    public function getRolesAttr($value)
    {
        return json_decode($value, true);
    }

    public function getPasswordAttr($value)
    {
        return md5($value);
    }

    public function quyu()
    {
        return $this->belongsTo("QuyuModel", 'qyid');

    }

    public function role()
    {
        return $this->belongsTo("RoleModel", 'roles');

    }

    public function setLatlngAttr($value)
    {
        return json_encode($value);
    }

    public function getLatlngAttr($value)
    {
        return json_decode($value, true);
    }

}
